#pragma once

#include <stdio.h>

namespace adapter {
    
/// @brief 目标接口, 即当前系统业务所期待的接口
class AbstractTarget {
public:
    virtual ~AbstractTarget() {}
    virtual void Request() = 0;
};

/// @brief 被适配者
class Adaptee {
public:
    virtual void SpecificRequest() {
        printf("this is Adaptee::SpecificRequest!\n");
    }
};

/// @brief 适配器, 把适被配者接口转换成目标接口，让客户按目标接口的格式访问被适配者
class Adapter : public Adaptee, public AbstractTarget {
public:
    virtual void Request() {
        SpecificRequest();
    }
};

} // namespace adapter 

void Test_07_adapter_impl_1() {
    printf("-------------------- %s --------------------\n", __FUNCTION__);
    adapter::AbstractTarget* ptr = new adapter::Adapter();
    ptr->Request();
    delete ptr;
}

// -------------------- Test_07_adapter_impl_1 --------------------
// this is Adaptee::SpecificRequest!